import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PricingRuleVO, PricingRuleForm, PricingRuleQuery } from '@/api/hotel/pricingRule/types';

/**
 * 查询酒店价格规则列表
 * @param query
 * @returns {*}
 */

export const listPricingRule = (query?: PricingRuleQuery): AxiosPromise<PricingRuleVO[]> => {
  return request({
    url: '/hotel/pricingRule/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询酒店价格规则详细
 * @param id
 */
export const getPricingRule = (id: string | number): AxiosPromise<PricingRuleVO> => {
  return request({
    url: '/hotel/pricingRule/' + id,
    method: 'get'
  });
};

/**
 * 新增酒店价格规则
 * @param data
 */
export const addPricingRule = (data: PricingRuleForm) => {
  return request({
    url: '/hotel/pricingRule',
    method: 'post',
    data: data
  });
};

/**
 * 修改酒店价格规则
 * @param data
 */
export const updatePricingRule = (data: PricingRuleForm) => {
  return request({
    url: '/hotel/pricingRule',
    method: 'put',
    data: data
  });
};

/**
 * 删除酒店价格规则
 * @param id
 */
export const delPricingRule = (id: string | number | Array<string | number>) => {
  return request({
    url: '/hotel/pricingRule/' + id,
    method: 'delete'
  });
};
